package com.sg.file.common.conf;

/**
 * 可视文件尺寸配置
 * Created by asus on 2018/6/28.
 */
public class VisibleFileSizeConf {
    private final static Size IMAGE_THUMBNAIL_SIZE = new Size(200D,130D);

    private final static Size IMAGE_SMALL_SIZE = new Size(640D,480D);
    private final static Size IMAGE_MIDDLE_SIZE = new Size(1024D,768D);
    private final static Size IMAGE_LARGE_SIZE = new Size(1920D,1080D);


    private final static Size VOIDE_SMALL_SIZE = new Size(320D,240D);
    private final static Size VOIDE_MIDDLE_SIZE = new Size(720D,480D);
    private final static Size VOIDE_LARGE_SIZE = new Size(800D,480D);

    /**
     * 获取图片尺寸
     * @param fileSizeType 文件尺寸类型 @see FileSizeTypeConf
     * @return
     */
    public static Size getImageSize(String fileSizeType){
        switch (fileSizeType){
            case FileSizeTypeConf.THUMBNAIL :
                return VisibleFileSizeConf.IMAGE_THUMBNAIL_SIZE;
            case FileSizeTypeConf.LARGE_SIZE :
                return VisibleFileSizeConf.IMAGE_LARGE_SIZE;
            case FileSizeTypeConf.MIDDLE_SIZE :
                return VisibleFileSizeConf.IMAGE_MIDDLE_SIZE;
            case FileSizeTypeConf.SMALL_SIZE :
                return VisibleFileSizeConf.IMAGE_SMALL_SIZE;
        }
        return null;
    }

    /**
     * 获取视频尺寸
     * @param fileSizeType 文件尺寸类型
     * @return
     */
    public static Size getVoideSize(String fileSizeType){
        switch (fileSizeType){
            case FileSizeTypeConf.THUMBNAIL :
                return VisibleFileSizeConf.IMAGE_THUMBNAIL_SIZE;
            case FileSizeTypeConf.LARGE_SIZE :
                return VisibleFileSizeConf.VOIDE_LARGE_SIZE;
            case FileSizeTypeConf.MIDDLE_SIZE :
                return VisibleFileSizeConf.VOIDE_MIDDLE_SIZE;
            case FileSizeTypeConf.SMALL_SIZE :
                return VisibleFileSizeConf.VOIDE_SMALL_SIZE;
        }
        return null;
    }

    /**
     * 内部内用于图片文件文件的宽高
     */
    public static class Size{
        /**
         * 文件宽
         */
        private Double width;
        /**
         * 文件高
         */
        private Double height;

        public Size(Double width,Double height) {
            this.width = width;
            this.height = height;
        }

        public Double getWidth() {
            return width;
        }

        public void setWidth(Double width) {
            this.width = width;
        }

        public Double getHeight() {
            return height;
        }

        public void setHeight(Double height) {
            this.height = height;
        }

        @Override
        public String toString() {
            return "Size{" +
                    "width=" + width +
                    ", height=" + height +
                    '}';
        }
    }
}
